\section{network::tcp\_\-socket Class Reference}
\label{classnetwork_1_1tcp__socket}\index{network::tcp_socket@{network::tcp\_\-socket}}
This class represents a tcp-socket.  


{\tt \#include $<$tcp\_\-socket.h$>$}

Inheritance diagram for network::tcp\_\-socket::\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2cm]{classnetwork_1_1tcp__socket}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
\bf{tcp\_\-socket} (boost::shared\_\-ptr$<$ \bf{tcp\_\-sock\_\-impl} $>$ impl)
\begin{CompactList}\small\item\em \doxyref{tcp\_\-socket}{p.}{classnetwork_1_1tcp__socket} creates a tcp-socket from a tcp\_\-sock\_\-impl. \item\end{CompactList}\item 
\bf{tcp\_\-socket} ()\label{classnetwork_1_1tcp__socket_7868bbedd0e91308b910d5e7675b470c}

\begin{CompactList}\small\item\em \doxyref{tcp\_\-socket}{p.}{classnetwork_1_1tcp__socket} creates a not connected socket, which can be bound to a local port. \item\end{CompactList}\item 
\bf{tcp\_\-socket} (const string \&addr, int port)
\begin{CompactList}\small\item\em \doxyref{tcp\_\-socket}{p.}{classnetwork_1_1tcp__socket} creates a tcp-socket. \item\end{CompactList}\item 
virtual \bf{$\sim$tcp\_\-socket} ()\label{classnetwork_1_1tcp__socket_032deac2aaed8798911b7d6fe3084364}

\item 
virtual void \bf{send} (const string \&str)
\begin{CompactList}\small\item\em send sends a string over the socket. \item\end{CompactList}\item 
virtual string \bf{recv} ()
\begin{CompactList}\small\item\em recv receives a string from the socket. Remember: this socket is a blocking socket! \item\end{CompactList}\item 
virtual bool \bf{listen} () const 
\begin{CompactList}\small\item\em listen listenes to new connections. \item\end{CompactList}\item 
virtual bool \bf{bind} (int port)
\begin{CompactList}\small\item\em bind binds the socket to a local port \item\end{CompactList}\item 
virtual bool \bf{accept} (\bf{tcp\_\-socket} \&sock)
\begin{CompactList}\small\item\em accept accepts a new connection \item\end{CompactList}\item 
boost::shared\_\-ptr$<$ \bf{tcp\_\-sock\_\-impl} $>$ \bf{get\_\-impl} ()
\begin{CompactList}\small\item\em get\_\-impl returns the tcp\_\-sock\_\-impl of this socket. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
This class represents a tcp-socket. 



Definition at line 45 of file tcp\_\-socket.h.

\subsection{Constructor \& Destructor Documentation}
\index{network::tcp_socket@{network::tcp\_\-socket}!tcp_socket@{tcp\_\-socket}}
\index{tcp_socket@{tcp\_\-socket}!network::tcp_socket@{network::tcp\_\-socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}network::tcp\_\-socket::tcp\_\-socket (boost::shared\_\-ptr$<$ \bf{tcp\_\-sock\_\-impl} $>$ {\em impl})\hspace{0.3cm}{\tt  [inline]}}\label{classnetwork_1_1tcp__socket_e7a8f002b7b87dfb02abcb98693f5d13}


\doxyref{tcp\_\-socket}{p.}{classnetwork_1_1tcp__socket} creates a tcp-socket from a tcp\_\-sock\_\-impl. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em impl}]is a tcp\_\-sock\_\-impl object) \end{description}
\end{Desc}


Definition at line 52 of file tcp\_\-socket.h.

\begin{Code}\begin{verbatim}52 :_impl(impl) {}
\end{verbatim}\end{Code}


\index{network::tcp_socket@{network::tcp\_\-socket}!tcp_socket@{tcp\_\-socket}}
\index{tcp_socket@{tcp\_\-socket}!network::tcp_socket@{network::tcp\_\-socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}network::tcp\_\-socket::tcp\_\-socket (const string \& {\em addr}, int {\em port})\hspace{0.3cm}{\tt  [inline]}}\label{classnetwork_1_1tcp__socket_0bc7b88c28161f9755e57eb7c8501ba9}


\doxyref{tcp\_\-socket}{p.}{classnetwork_1_1tcp__socket} creates a tcp-socket. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em addr}]is the ip-address to which you want to connect. \item[{\em port}]is the port to which you want to connect. \end{description}
\end{Desc}


Definition at line 64 of file tcp\_\-socket.h.

\begin{Code}\begin{verbatim}65                 {
66                         _impl.reset(new tcp_sock_impl(addr, port));
67                 }
\end{verbatim}\end{Code}




\subsection{Member Function Documentation}
\index{network::tcp_socket@{network::tcp\_\-socket}!accept@{accept}}
\index{accept@{accept}!network::tcp_socket@{network::tcp\_\-socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual bool network::tcp\_\-socket::accept (\bf{tcp\_\-socket} \& {\em sock})\hspace{0.3cm}{\tt  [inline, virtual]}}\label{classnetwork_1_1tcp__socket_326b73c23157bcea0aeda8b6d60af65e}


accept accepts a new connection 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em sock}]is the socket of the new connection.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if accept was successfull. \end{Desc}


Definition at line 105 of file tcp\_\-socket.h.

\begin{Code}\begin{verbatim}106                 {
107                         return _impl->accept(*sock.get_impl());
108                 }
\end{verbatim}\end{Code}


\index{network::tcp_socket@{network::tcp\_\-socket}!bind@{bind}}
\index{bind@{bind}!network::tcp_socket@{network::tcp\_\-socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual bool network::tcp\_\-socket::bind (int {\em port})\hspace{0.3cm}{\tt  [inline, virtual]}}\label{classnetwork_1_1tcp__socket_417b389dfc3cf09ed2e357cde025b316}


bind binds the socket to a local port 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em port}]is the port to which the socket should connect\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if the bind was successfull \end{Desc}


Definition at line 97 of file tcp\_\-socket.h.

\begin{Code}\begin{verbatim}97 {return _impl->bind(port);}
\end{verbatim}\end{Code}


\index{network::tcp_socket@{network::tcp\_\-socket}!get_impl@{get\_\-impl}}
\index{get_impl@{get\_\-impl}!network::tcp_socket@{network::tcp\_\-socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}boost::shared\_\-ptr$<$\bf{tcp\_\-sock\_\-impl}$>$ network::tcp\_\-socket::get\_\-impl ()\hspace{0.3cm}{\tt  [inline]}}\label{classnetwork_1_1tcp__socket_c7563b7f844fdc8383436d5c263f5df7}


get\_\-impl returns the tcp\_\-sock\_\-impl of this socket. 

\begin{Desc}
\item[Returns:]a shared\_\-ptr to the tcp\_\-sock\_\-impl-object \end{Desc}


Definition at line 115 of file tcp\_\-socket.h.

\begin{Code}\begin{verbatim}115 {return _impl;}
\end{verbatim}\end{Code}


\index{network::tcp_socket@{network::tcp\_\-socket}!listen@{listen}}
\index{listen@{listen}!network::tcp_socket@{network::tcp\_\-socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual bool network::tcp\_\-socket::listen () const\hspace{0.3cm}{\tt  [inline, virtual]}}\label{classnetwork_1_1tcp__socket_110a2d585a914132da4823bb17f6ad0b}


listen listenes to new connections. 

\begin{Desc}
\item[Returns:]true if a new connection was established \end{Desc}


Definition at line 89 of file tcp\_\-socket.h.

\begin{Code}\begin{verbatim}89 {return _impl->listen();}
\end{verbatim}\end{Code}


\index{network::tcp_socket@{network::tcp\_\-socket}!recv@{recv}}
\index{recv@{recv}!network::tcp_socket@{network::tcp\_\-socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}string network::tcp\_\-socket::recv ()\hspace{0.3cm}{\tt  [virtual]}}\label{classnetwork_1_1tcp__socket_20c373a6228e1234636e5efc12243da2}


recv receives a string from the socket. Remember: this socket is a blocking socket! 

\begin{Desc}
\item[Returns:]a string is returned. \end{Desc}


Implements \bf{network::i\_\-socket} \doxyref{p.}{classnetwork_1_1i__socket_611208a9f52680378427b1fff5e22ed9}.

Definition at line 12 of file tcp\_\-socket.cpp.

\begin{Code}\begin{verbatim}13 {
14         return _impl->read();
15 }
\end{verbatim}\end{Code}


\index{network::tcp_socket@{network::tcp\_\-socket}!send@{send}}
\index{send@{send}!network::tcp_socket@{network::tcp\_\-socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void network::tcp\_\-socket::send (const string \& {\em str})\hspace{0.3cm}{\tt  [virtual]}}\label{classnetwork_1_1tcp__socket_5e838337e232bfc5ef45fa0a1ff1db57}


send sends a string over the socket. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em str}]is the string which should be send. \end{description}
\end{Desc}


Implements \bf{network::i\_\-socket} \doxyref{p.}{classnetwork_1_1i__socket_8cb41213426b4744601dacba0ddae3fc}.

Definition at line 7 of file tcp\_\-socket.cpp.

\begin{Code}\begin{verbatim}8 {
9         _impl->write(str);
10 }
\end{verbatim}\end{Code}




The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
network/tcp\_\-socket.h\item 
network/tcp\_\-socket.cpp\end{CompactItemize}
